//
//  RLAttentionCell.m
//  RelaxLinkProduct
//
//  Created by relax on 2017/11/26.
//  Copyright © 2017年 relax. All rights reserved.
//

#import "RLAttentionCell.h"

@interface RLAttentionCell ()
/** 头像 */
@property (nonatomic,weak) UIImageView *headerImageView;
/** 昵称 */
@property (nonatomic,copy) UILabel *nameLabel;
/** 位置 */
@property (nonatomic,copy) UILabel *locationLabel;
/** 当前收看人数 */
@property (nonatomic,copy) UILabel *audienceCountLabel;

/** 主播 */
@property (nonatomic,weak) UIButton *liverPhotoButon;

/** 是否直播 */
@property (nonatomic,weak) UILabel *isLiveStreamingLabel;

@end

@implementation RLAttentionCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initUI];
    }
    
    return self;
}

#pragma mark - 初始化 UI
- (void)initUI {
    // 1. 头像
    UIImageView *headerImageView = [[UIImageView alloc] init];
    [[UIImage imageNamed:@"dahuan_750x750_@1x"] rl_cornerImageWithSize:CGSizeMake(40, 40) fillColor:[UIColor whiteColor] complectionBlock:^(UIImage *image) {
        headerImageView.image = image;
    }];
    
//    headerImageView.layer.cornerRadius = 20;
//    headerImageView.clipsToBounds = YES;
    [self.contentView addSubview:headerImageView];
    [headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(8);
        make.width.height.offset(40);
    }];
    
    // 2. 昵称
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.text = @"郭青松";
    [self.contentView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerImageView.mas_right).offset(8);
        make.top.equalTo(headerImageView);
    }];

    // 3. 地址
    UILabel *locationLabel = [[UILabel alloc] init];
    locationLabel.text = @"北京";
    locationLabel.textColor = [UIColor lightGrayColor];
    locationLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:locationLabel];
    [locationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(headerImageView);
        make.left.equalTo(nameLabel);
    }];

    // 4. 在线观看人数
    UILabel *audienceCountLabel = [[UILabel alloc] init];
    audienceCountLabel.text = @"100";
    audienceCountLabel.textColor = [UIColor colorWithRed:0.97647 green:0.47451 blue:0.04314 alpha:1.00000];
    [self.contentView addSubview:audienceCountLabel];
    [audienceCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-8);
        make.top.equalTo(headerImageView);
    }];

    // 5. "在看"
    UILabel *lookingLabel = [[UILabel alloc] init];
    lookingLabel.textColor = [UIColor lightGrayColor];
    lookingLabel.text = @"在看";
    lookingLabel.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:lookingLabel];
    
    [lookingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(audienceCountLabel);
        make.bottom.equalTo(headerImageView);
    }];
    
    // 6. 主播照片
    UIButton *photoButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [photoButton setImage:[UIImage imageNamed:@"dahuan_750x750_@1x"] forState:UIControlStateNormal];
    [self.contentView addSubview:photoButton];
    [photoButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headerImageView.mas_bottom).offset(8);
        make.left.offset(0);
        make.width.height.offset(SCREEN_WIDTH);
       // make.bottom.offset(-8);
    }];
}

@end
